using System;
using System.Collections.Generic;
using System.Linq;

using Sustainalytics.Entities;
using Sustainalytics.Utils;
using Sustainalytics.Utils.Validation.Interfaces;

namespace Sustainalytics.Portfolios.BL.Validators
{
    public class PortfolioWriteValidator : IValidator<Portfolio, PortfolioUserClaims>
    {
        public bool IsValid(Portfolio portfolio, PortfolioUserClaims userClaims)
        {
            return portfolio.AccountIds.Contains(userClaims.AccountId)
                   && string.Equals(
                       portfolio.AddedByUserName,
                       userClaims.UserName,
                       StringComparison.InvariantCultureIgnoreCase);
        }

        public ICollection<string> BrokenRules(Portfolio entity, PortfolioUserClaims entityAgainstValidate)
        {
            return new List<string>();
        }
    }
}